<template>
  <div class="song-of">
    <ul>
      <li v-for="(item, index) in listData" :key="index">
        <div class="cover">
          <van-image :src="item.coverImgUrl" radius="10px" />
          <span>{{ item.playCount | numFilter(1) }}万</span>
        </div>
        <span>{{ item.name }}</span>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  props: ["singeid"],
  data() {
    return {
      listData: [],
    };
  },
  created() {
    this.getSongData();
  },
  methods: {
    getSongData() {
      this.$request("get", "top/playlist/highquality").then((res) => {
        console.log("Official", res);
        if (res.code == 200) {
          this.listData = res.playlists;
        }
      });
    },
  },
  filters: {
    numFilter(value, num) {
      return parseFloat(value / 10000).toFixed(num);
    },
  },
};
</script>
<style scoped>
.song-of > ul {
  display: flex;
  flex-wrap: wrap;
}
.song-of > ul > li {
  width: calc((100% - 1rem) / 3 * 1);
}
.song-of > ul > li:nth-of-type(3n + 2) {
  margin-left: 0.5rem;
  margin-right: 00.5rem;
}
.cover > span {
  position: absolute;
  right: 0;
  bottom: 0.3rem;
  background-color: red;
}

.cover {
  position: relative;
}
.cover > span {
  position: absolute;
  right: 0.2rem;
  bottom: 0.4rem;
  background-color: #a6a0a0;
  color: white;
  font-size: 14px;
  border-radius: 1rem;
  width: 4rem;
  display: inline-block;
}
</style> 